
import request from '@/utils/request'

const api = {
    getReceiptList: '/v1/receipt/page/list', // 获取发票分页列表
    getReceiptDetail: '/v1/receipt/detail/', // 获取发票详情信息
    getReceiptRelationSettlementList: '/v1/receipt/relation/settlement/list/', // 获取发票关联的结算单信息
    refuseReceipt: '/v1/receipt/refuse', // 拒绝发票申请
    adoptReceipt: '/v1/receipt/adopt/', // 通过发票申请
    makeReceipt: '/v1/receipt/billing', // 开票
    mailReceipt: '/v1/receipt/post', // 邮寄发票
    updateReceipt: '/v1/receipt/post/update', // 修改发票快递信息、发票查询码、发票快照
}

// 获取发票分页列表
export function getReceiptList (parameter) {
    return request({
        url: api.getReceiptList,
        method: 'get',
        headers: {
            'name':'getReceiptList',
        },
        params: parameter
    })
}

// 获取发票详情信息
export function getReceiptDetail (receiptId) {
    return request({
        url: api.getReceiptDetail + receiptId,
        method: 'get',
        headers: {
            'name':'getReceiptDetail',
        },
        params: {}
    })
}

// 获取发票关联的结算单信息
export function getReceiptRelationSettlementList (receiptId) {
    return request({
        url: api.getReceiptRelationSettlementList + receiptId,
        method: 'get',
        headers: {
            'name':'getReceiptRelationSettlementList',
        },
        params: {}
    })
}

// 拒绝发票申请
export function refuseReceipt (parameter) {
    return request({
        url: api.refuseReceipt,
        method: 'post',
        headers: {
            'name':'refuseReceipt',
        },
        data: parameter
    })
}

// 通过发票申请
export function adoptReceipt (receiptId) {
    return request({
        url: api.adoptReceipt + receiptId,
        method: 'post',
        headers: {
            'name':'adoptReceipt',
        },
        data: {}
    })
}

// 开票
export function makeReceipt (parameter) {
    return request({
        url: api.makeReceipt,
        method: 'post',
        headers: {
            'name':'makeReceipt',
        },
        data: parameter
    })
}

// 邮寄发票
export function mailReceipt (parameter) {
    return request({
        url: api.mailReceipt,
        method: 'post',
        headers: {
            'name':'mailReceipt',
        },
        data: parameter
    })
}

// 修改发票快递信息、发票查询码、发票快照
export function updateReceipt (parameter) {
    return request({
        url: api.updateReceipt,
        method: 'post',
        headers: {
            'name':'updateReceipt',
        },
        data: parameter
    })
}